# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：      root_rdp
   Description:
   Author:          Administrator
   date：           2019-01-21
-------------------------------------------------
   Change Activity:
                    2019-01-21:
-------------------------------------------------
"""
from utils.guacamole import MyGuacamole
from utils.crypt_pwd import CryptPwd
from fort.models import FortServerUser


class AdminGuacamole(MyGuacamole):
    def __init__(self, *args, **kwargs):
        super(AdminGuacamole, self).__init__(*args, **kwargs)
        self.fort_user = FortServerUser.objects.get(id=self.scope['path'].split('/')[3])
        self.ip = self.fort_user.fort_server.server.IP
        self.port = self.fort_user.fort_server.port
        self.username = self.fort_user.fort_username
        self.password = CryptPwd().decrypt_pwd(self.fort_user.fort_password)

